package it.prova.type;

import it.prova.Consts;
import it.prova.Utility;

import java.util.List;

import nu.xom.Document;

import org.eclipse.jst.jsf.metadataprocessors.features.IDefaultValue;
import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues;
import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues;
import org.eclipse.jst.jsf.metadataprocessors.features.PossibleValue;
import org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage;
import org.eclipse.jst.jsf.taglibprocessing.attributevalues.EnumerationType;

@SuppressWarnings("unchecked")
public class EntryUnitNameAttributeValueRuntimeType extends EnumerationType implements IValidValues, IPossibleValues, IDefaultValue
{	
	private Document currentModel;
	
	@Override
	public boolean isValidValue(String value)
	{
		if(value.length() == 0)
		{
			getValidationMessages().add(new ValidationMessage("The 'name' attribute must be a non-zero length String."));
			return false;
		}
		else
		{
			return true;
		}
	}

	@Override
	protected String getReturnType()
	{
		return "it.prova.type.MyAttributeValueRuntimeType";
	}
	
	public List<PossibleValue> getPossibleValues()
	{
		return Utility.getEntryUnitNamePossibleValues();
	}
}